import 'package:distribution_mall_flutter/generated/json/base/json_convert_content.dart';
import 'package:distribution_mall_flutter/pages/address/domain/action_address_item_entity.dart';

ActionAddressItemBody $ActionAddressItemBodyFromJson(
    Map<String, dynamic> json) {
  final ActionAddressItemBody actionAddressItemBody = ActionAddressItemBody();
  final dynamic backupDetailInfo = json['backupDetailInfo'];
  if (backupDetailInfo != null) {
    actionAddressItemBody.backupDetailInfo = backupDetailInfo;
  }
  final String? city = jsonConvert.convert<String>(json['city']);
  if (city != null) {
    actionAddressItemBody.city = city;
  }
  final String? country = jsonConvert.convert<String>(json['country']);
  if (country != null) {
    actionAddressItemBody.country = country;
  }
  final String? detailInfo = jsonConvert.convert<String>(json['detailInfo']);
  if (detailInfo != null) {
    actionAddressItemBody.detailInfo = detailInfo;
  }
  final String? distributorAddressId = jsonConvert.convert<String>(
      json['distributorAddressId']);
  if (distributorAddressId != null) {
    actionAddressItemBody.distributorAddressId = distributorAddressId;
  }
  final dynamic distributorId = json['distributorId'];
  if (distributorId != null) {
    actionAddressItemBody.distributorId = distributorId;
  }
  final String? district = jsonConvert.convert<String>(json['district']);
  if (district != null) {
    actionAddressItemBody.district = district;
  }
  final bool? isDef = jsonConvert.convert<bool>(json['isDef']);
  if (isDef != null) {
    actionAddressItemBody.isDef = isDef;
  }
  final String? phone = jsonConvert.convert<String>(json['phone']);
  if (phone != null) {
    actionAddressItemBody.phone = phone;
  }
  final String? province = jsonConvert.convert<String>(json['province']);
  if (province != null) {
    actionAddressItemBody.province = province;
  }
  final String? recipientName = jsonConvert.convert<String>(
      json['recipientName']);
  if (recipientName != null) {
    actionAddressItemBody.recipientName = recipientName;
  }
  final String? street = jsonConvert.convert<String>(json['street']);
  if (street != null) {
    actionAddressItemBody.street = street;
  }
  final String? virtualPostcode = jsonConvert.convert<String>(
      json['virtualPostcode']);
  if (virtualPostcode != null) {
    actionAddressItemBody.virtualPostcode = virtualPostcode;
  }
  final String? zip = jsonConvert.convert<String>(json['zip']);
  if (zip != null) {
    actionAddressItemBody.zip = zip;
  }
  return actionAddressItemBody;
}

Map<String, dynamic> $ActionAddressItemBodyToJson(
    ActionAddressItemBody entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['backupDetailInfo'] = entity.backupDetailInfo;
  data['city'] = entity.city;
  data['country'] = entity.country;
  data['detailInfo'] = entity.detailInfo;
  data['distributorAddressId'] = entity.distributorAddressId;
  data['distributorId'] = entity.distributorId;
  data['district'] = entity.district;
  data['isDef'] = entity.isDef;
  data['phone'] = entity.phone;
  data['province'] = entity.province;
  data['recipientName'] = entity.recipientName;
  data['street'] = entity.street;
  data['virtualPostcode'] = entity.virtualPostcode;
  data['zip'] = entity.zip;
  return data;
}

extension ActionAddressItemBodyExtension on ActionAddressItemBody {
  ActionAddressItemBody copyWith({
    dynamic backupDetailInfo,
    String? city,
    String? country,
    String? detailInfo,
    String? distributorAddressId,
    dynamic distributorId,
    String? district,
    bool? isDef,
    String? phone,
    String? province,
    String? recipientName,
    String? street,
    String? virtualPostcode,
    String? zip,
  }) {
    return ActionAddressItemBody()
      ..backupDetailInfo = backupDetailInfo ?? this.backupDetailInfo
      ..city = city ?? this.city
      ..country = country ?? this.country
      ..detailInfo = detailInfo ?? this.detailInfo
      ..distributorAddressId = distributorAddressId ?? this.distributorAddressId
      ..distributorId = distributorId ?? this.distributorId
      ..district = district ?? this.district
      ..isDef = isDef ?? this.isDef
      ..phone = phone ?? this.phone
      ..province = province ?? this.province
      ..recipientName = recipientName ?? this.recipientName
      ..street = street ?? this.street
      ..virtualPostcode = virtualPostcode ?? this.virtualPostcode
      ..zip = zip ?? this.zip;
  }
}